package com.catazzz.springbootstudy.controller;

import com.catazzz.springbootstudy.common.exception.ApiException;
import com.catazzz.springbootstudy.common.exception.MessageEnum;
import com.catazzz.springbootstudy.common.exception.Result;
import io.swagger.annotations.Api;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @作者: Tao
 * @日期: 2025/1/2
 * @时间: 14:26
 * @描述: <br><pre>
 */
@Api(tags = "异常")
@RestController
@RequestMapping("/exception")
public class ExceptionController {

    @GetMapping("/apiException")
    public Result<Boolean> apiException() {
        throw new ApiException(MessageEnum.ERROR);
    }

    /**
     * 测试运行时异常
     * @return Result<Boolean>
     */
    @GetMapping("/runtimeException")
    public Result<Boolean> runtimeException() {
        throw new RuntimeException();
    }
}
